package com.example.spring;

import com.example.config.UserConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class BeanLifeAround {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(UserConfig.class);
        User1 bean1 = applicationContext.getBean(User1.class);
        System.out.println("Id: " + bean1.getId() + " Name: " + bean1.getName() + " TraceId: " + bean1.getTraceId());

        User2 bean2 = applicationContext.getBean(User2.class);
        System.out.println("Id: " + bean2.getId() + " Name: " + bean2.getName() + " TraceId: " + bean2.getTraceId());
    }
}
